package cn.schoolwow.workflow.module.task.action.flow.complete.nodeType.general;

import cn.schoolwow.quickflow.domain.FlowContext;
import cn.schoolwow.quickflow.flow.BusinessFlow;
import cn.schoolwow.workflow.entity.WorkFlowNode;
import cn.schoolwow.workflow.module.common.flow.AddWorkFlowHistoryFlow;
import cn.schoolwow.workflow.module.task.action.flow.common.AutomaticPassNodeCommonFlow;

public class HandlePassNodeFlow implements BusinessFlow {
    @Override
    public void executeBusinessFlow(FlowContext flowContext) throws Exception {
        WorkFlowNode nextNode = flowContext.checkData("nextNode", WorkFlowNode.class);

        flowContext.startFlow(new AddWorkFlowHistoryFlow())
                .putCurrentCompositeFlowData("message", "自动通过节点["+nextNode.getName()+"]")
                .execute();

        flowContext.startFlow(new AutomaticPassNodeCommonFlow())
                .putCurrentCompositeFlowData("passNode", nextNode)
                .execute();
    }

    @Override
    public String name() {
        return "处理自动通过节点";
    }
}
